<?php

namespace JLPay\Models\Trans\Dto;

/**
 * 终端信息DTO
 * 
 * @author liaochangyi
 * @since 2025-01-25
 */
class TerminalInfoDto
{
    protected ?string $networkLicense = null;  // 银行卡受理终端入网编号
    protected ?string $deviceType = null;  // 设备类型
    protected ?string $serialNum = null;  // 设备序列号
    protected ?string $encryptRandNum = null;  // 加密随机因子
    protected ?string $secretText = null;  // 密文数据
    protected ?string $appVersion = null;  // 终端应用版本号
    protected ?string $mobileCountryCd = null;  // 移动国家代码
    protected ?string $mobileNetworkNum = null;  // 移动网络号码
    protected ?string $iccId = null;  // ICCID
    protected ?string $locationCd1 = null;  // 位置区域码 1
    protected ?string $lbsNum1 = null;  // 基站编号 1
    protected ?string $lbsSignal1 = null;  // 基站信号 1
    protected ?string $locationCd2 = null;  // 位置区域码 2
    protected ?string $lbsNum2 = null;  // 基站编号 2
    protected ?string $lbsSignal2 = null;  // 基站信号 2
    protected ?string $locationCd3 = null;  // 位置区域码 3
    protected ?string $lbsNum3 = null;  // 基站编号 3
    protected ?string $lbsSignal3 = null;  // 基站信号 3
    protected ?string $telecomSystemId = null;  // 电信系统识别码
    protected ?string $telecomNetworkId = null;  // 电信网络识别码
    protected ?string $telecomLbs = null;  // 电信基站
    protected ?string $telecomLbsSignal = null;  // 电信基站信号

    /**
     * 构造函数
     *
     * @param array|null $terminalDict 终端信息字典
     */
    public function __construct(?array $terminalDict = null)
    {
        if ($terminalDict) {
            $this->networkLicense = $terminalDict['network_license'] ?? null;
            $this->deviceType = $terminalDict['device_type'] ?? null;
            $this->serialNum = $terminalDict['serial_num'] ?? null;
            $this->encryptRandNum = $terminalDict['encrypt_rand_num'] ?? null;
            $this->secretText = $terminalDict['secret_text'] ?? null;
            $this->appVersion = $terminalDict['app_version'] ?? null;
            $this->mobileCountryCd = $terminalDict['mobile_country_cd'] ?? null;
            $this->mobileNetworkNum = $terminalDict['mobile_network_num'] ?? null;
            $this->iccId = $terminalDict['icc_id'] ?? null;
            $this->locationCd1 = $terminalDict['location_cd1'] ?? null;
            $this->lbsNum1 = $terminalDict['lbs_num1'] ?? null;
            $this->lbsSignal1 = $terminalDict['lbs_signal1'] ?? null;
            $this->locationCd2 = $terminalDict['location_cd2'] ?? null;
            $this->lbsNum2 = $terminalDict['lbs_num2'] ?? null;
            $this->lbsSignal2 = $terminalDict['lbs_signal2'] ?? null;
            $this->locationCd3 = $terminalDict['location_cd3'] ?? null;
            $this->lbsNum3 = $terminalDict['lbs_num3'] ?? null;
            $this->lbsSignal3 = $terminalDict['lbs_signal3'] ?? null;
            $this->telecomSystemId = $terminalDict['telecom_system_id'] ?? null;
            $this->telecomNetworkId = $terminalDict['telecom_network_id'] ?? null;
            $this->telecomLbs = $terminalDict['telecom_lbs'] ?? null;
            $this->telecomLbsSignal = $terminalDict['telecom_lbs_signal'] ?? null;
        }
    }

    /**
     * 获取银行卡受理终端入网编号
     *
     * @return string|null
     */
    public function getNetworkLicense(): ?string
    {
        return $this->networkLicense;
    }

    /**
     * 设置银行卡受理终端入网编号
     *
     * @param string|null $networkLicense
     * @return self
     */
    public function setNetworkLicense(?string $networkLicense): self
    {
        $this->networkLicense = $networkLicense;
        return $this;
    }

    /**
     * 获取设备类型
     *
     * @return string|null
     */
    public function getDeviceType(): ?string
    {
        return $this->deviceType;
    }

    /**
     * 设置设备类型
     *
     * @param string|null $deviceType
     * @return self
     */
    public function setDeviceType(?string $deviceType): self
    {
        $this->deviceType = $deviceType;
        return $this;
    }

    /**
     * 获取设备序列号
     *
     * @return string|null
     */
    public function getSerialNum(): ?string
    {
        return $this->serialNum;
    }

    /**
     * 设置设备序列号
     *
     * @param string|null $serialNum
     * @return self
     */
    public function setSerialNum(?string $serialNum): self
    {
        $this->serialNum = $serialNum;
        return $this;
    }

    /**
     * 转换为数组格式
     *
     * @return array
     */
    public function toArray(): array
    {
        return [
            'network_license' => $this->networkLicense,
            'device_type' => $this->deviceType,
            'serial_num' => $this->serialNum,
            'encrypt_rand_num' => $this->encryptRandNum,
            'secret_text' => $this->secretText,
            'app_version' => $this->appVersion,
            'mobile_country_cd' => $this->mobileCountryCd,
            'mobile_network_num' => $this->mobileNetworkNum,
            'icc_id' => $this->iccId,
            'location_cd1' => $this->locationCd1,
            'lbs_num1' => $this->lbsNum1,
            'lbs_signal1' => $this->lbsSignal1,
            'location_cd2' => $this->locationCd2,
            'lbs_num2' => $this->lbsNum2,
            'lbs_signal2' => $this->lbsSignal2,
            'location_cd3' => $this->locationCd3,
            'lbs_num3' => $this->lbsNum3,
            'lbs_signal3' => $this->lbsSignal3,
            'telecom_system_id' => $this->telecomSystemId,
            'telecom_network_id' => $this->telecomNetworkId,
            'telecom_lbs' => $this->telecomLbs,
            'telecom_lbs_signal' => $this->telecomLbsSignal
        ];
    }
} 